#pragma once
#include <pthread.h>

class LockGuard
{
    pthread_mutex_t &_pmtx;

public:
    LockGuard(pthread_mutex_t &pmtx)
        : _pmtx(pmtx)
    {
        pthread_mutex_lock(&_pmtx);
    }
    ~LockGuard()
    {
        pthread_mutex_unlock(&_pmtx);
    }
};
